Skip to content

Add AI Tools plugin detection to the user-agent#5924

Merged
shreyas-goenka merged 3 commits into
mainfrom
parthban-db/stack/skills-status
Jul 15, 2026
Merged

Add AI Tools plugin detection to the user-agent#5924
shreyas-goenka merged 3 commits into
mainfrom
parthban-db/stack/skills-status

Conversation

@parthban-db

@parthban-db parthban-db commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🥞 Stacked PR

Use this link to review incremental changes.


Changes

Emit an aitools/<tool> pair in the CLI user-agent for each coding tool that has the Databricks plugin installed (e.g. aitools/claude-code aitools/codex), so plugin adoption is measurable per tool from request telemetry. When no tool has it installed, no aitools/ pair is added at all. A tool counts as installed if either signal says so: the plugin is present in the tool's own plugin cache (<configDir>/plugins/cache/*/databricks), or the plugin is recorded in the CLI install state. Detection runs over every agent in the registry that ships a plugin (Claude Code, Codex, Copilot); skills-only agents are not reported.

Why

Coding-agent usage is already visible in the user-agent (the SDK's agent/ dimension), but whether Databricks AI Tools are actually installed is not, so adoption cannot be measured. Reading only the CLI install state would undercount badly: the Databricks plugin is published in the agents' own plugin marketplaces, so an install done directly through the agent (not via databricks aitools install) leaves nothing in the CLI state. The plugin cache on disk is the ground truth that captures those direct installs. Taking the union of the on-disk cache and the CLI state maximizes coverage and only ever over-counts a stale record, never hides a real install — the right bias for an adoption signal.

Tests

Unit tests for on-disk plugin detection (HasDatabricksPlugin, including the varying marketplace segment and wrong-plugin-id cases) and for InstalledTools covering disk-only (direct-marketplace install), state-only across global and project scope, the disk+state union with dedup, and skipping records for agents no longer in the registry. A cmd/root test asserts the user-agent emission contract (one aitools/<tool> pair per installed tool, nothing when none). The existing user-agent acceptance test is unaffected: the test harness runs with an isolated empty home directory, so the dimension stays silent.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 20147d1

Run: 29348048080

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 230 1087 5:31
💚​ aws windows 4 4 232 1085 7:23
💚​ aws-ucws linux 4 4 316 1004 6:09
💚​ aws-ucws windows 4 4 318 1002 6:48
💚​ azure linux 4 4 230 1086 5:23
🔄​ azure windows 2 2 4 232 1084 8:51
🔄​ azure-ucws linux 2 2 4 318 1001 7:22
💚​ azure-ucws windows 4 4 320 999 7:07
💚​ gcp linux 4 4 229 1088 5:02
💚​ gcp windows 4 4 231 1086 7:21
8 interesting tests: 4 SKIP, 2 RECOVERED, 2 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f 🔄​f 💚​R 💚​R 💚​R
🔄​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f 🔄​f 💚​R 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
6:26 gcp windows TestAccept
6:07 aws windows TestAccept
6:07 azure windows TestAccept
5:58 azure-ucws windows TestAccept
5:52 aws-ucws windows TestAccept
2:55 gcp linux TestAccept
2:55 aws linux TestAccept
2:54 azure linux TestAccept
2:50 aws-ucws linux TestAccept
2:44 azure-ucws linux TestAccept

@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from f0bf565 to 20e717d Compare July 14, 2026 13:10
@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 20e717d to 7cb15f0 Compare July 14, 2026 13:27
@parthban-db parthban-db changed the title add skills detection Add AI Tools plugin detection to the user-agent Jul 14, 2026
@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 7cb15f0 to 72cf29c Compare July 14, 2026 15:59
@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 72cf29c to 20147d1 Compare July 14, 2026 16:02
Comment thread libs/aitools/agents/detect_test.go Outdated
Comment thread cmd/root/user_agent_aitools.go Outdated
Comment on lines +18 to +26
func withAiToolsInUserAgent(ctx context.Context) context.Context {
// Each tool appends one aitools/<tool>_<version> pair to the same context;
// these accumulate, so this is not the accidental context nesting fatcontext
// flags.
for _, tool := range installer.InstalledTools(ctx) {
ctx = useragent.InContext(ctx, aiToolsKey, tool) //nolint:fatcontext
}
return ctx
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also test this function as this the single top level call point for new functionality? Maybe move it in installer as a public function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure which tests you want to add.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move it in installer as a public function?

I am fine with doing the change. As per Claude, it is just consistent with other parts of the code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure which tests you want to add.

Testing that the returned context is correct given the passed input and the environment. Think about it as an end-to-end unit test for your new call tree.

I am fine with doing the change. As per Claude, it is just consistent with other parts of the code

Testing this function would require to share some of the testing utilities you have in the other package. Collocating them centralizes that logic.

@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 20147d1 to 2780658 Compare July 14, 2026 21:52
@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 2780658 to 7afc61b Compare July 14, 2026 22:49
@parthban-db parthban-db force-pushed the parthban-db/stack/skills-status branch from 05c3367 to b38dfa2 Compare July 15, 2026 08:09
@parthban-db parthban-db enabled auto-merge July 15, 2026 08:10
@shreyas-goenka

Copy link
Copy Markdown
Contributor

Force merging to unblock PR - given that CI is red.

@shreyas-goenka shreyas-goenka disabled auto-merge July 15, 2026 09:43
@shreyas-goenka shreyas-goenka merged commit bd904fe into main Jul 15, 2026
23 of 24 checks passed
@shreyas-goenka shreyas-goenka deleted the parthban-db/stack/skills-status branch July 15, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants